let initData = {
    name:"张三",
    arr:[],
    arr1:[]
}
let AppReducer = (state = initData ,{type,payload,ispull})=>{
    switch (type) {
        case "changename" :
            return {
                ...state,
                name:payload
            }
        case "getList" :
             return {
                 ...state,
                 arr:payload
             }
        case "getpulllist" :
             let newarr1 = JSON.parse(JSON.stringify(state.arr1))
            if (ispull == "xiala") {
                newarr1 = payload
                return {
                    ...state,
                    arr1:newarr1
                }
            }else if (ispull == "shangla") {
                 let newarr2 = [...newarr1,...payload]
                 return {
                     ...state,
                     arr1:newarr2
                 }
            } else {
                newarr1 = payload
                return {
                    ...state,
                    arr1:newarr1
                }
            }
           
        default:
            return {
                ...state
            }
    }
}   
export default AppReducer